package org.example.extend.cmp2;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/**
 * 第一个扩展点，只有 applicationContext 是手动 refresh 的时候才生效，这个需要手动进行添加
 * String[] configLocations = new String[]{"classpath:applicationContext.xml"};
 * // 实例化
 * ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(configLocations, false, null);
 * <p>
 * // 第一个扩展点，refresh = false 的时候才是第一个
 * context.addBeanFactoryPostProcessor(new ManualRefreshBeanFactoryPostProcessor());
 * // 手动 refresh
 * context.refresh();
 *
 * @author xiajiqiu
 * @since 2024/6/8 12:31
 */
@Slf4j
public class ManualRefreshBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        log.info("first extend point");
    }
}
